You can use a layer control in leaflet to allow your users to
interactively turn layers on and off. The documentation for the
leaflet package has some explanation of layer controls here.
This example uses the following packages
library(tidyverse)
library(sf)
library(leaflet)
library(here)
Here is a historic map of Boston with polygon layers showing 9-inch (dark blue) and 36-inch (light blue) sea-level rise scenarios, along with black circles for the locations of bike share stations.
leaflet() %>%
addTiles(urlTemplate = "https://allmaps.xyz/maps/ad0210f48b2636b9/{z}/{x}/{y}.png") %>%
addPolygons(data = hi_tide_36_inch,
weight = 1,
fillColor = "cornflowerblue",
fillOpacity = 0.9) %>%
addPolygons(data = hi_tide_9_inch,
weight = 1,
fillColor = "darkblue",
fillOpacity = 0.9) %>%
addCircleMarkers(data = bikes,
color = "black",
radius = 2,
opacity = 1) %>%
setView(lng = -71.052164, lat = 42.360081, zoom = 15)